package cn.silver.module.quartz.domain;

import cn.silver.framework.mybatis.annotation.Table;
import cn.silver.framework.mybatis.domain.BusEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serial;

/**
 * 定时任务调度表 sys_job
 *
 * @author Silver.Zhou
 */
@Data
@NoArgsConstructor
@Table(name = "sys_job")
@EqualsAndHashCode(callSuper = true)
@Schema(name = "SysJob", description = "定时任务调度表")
public class SysJob extends BusEntity {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 任务组名
     */
    @Schema(title = "任务组名")
    private String group;

    /**
     * 调用目标字符串
     */
    @Schema(title = "调用目标字符串")
    private String invoke;

    /**
     * cron执行表达式
     */
    @Schema(title = "执行表达式")
    private String expression;

    /**
     * cron计划策略
     */
    @Schema(title = "计划策略")
    private String strategy;

    /**
     * 是否并发执行
     */
    @Schema(title = "是否并发执行")
    private Boolean concurrent;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("code", getCode())
                .append("name", getName())
                .append("group", getGroup())
                .append("invoke", getInvoke())
                .append("expression", getExpression())
                .append("strategy", getStrategy())
                .append("concurrent", getConcurrent())
                .append("status", getStatus())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .toString();
    }
}
